<script setup lang="ts">
import { useStore } from '@/stores'
const { user } = useStore()
// import request from '@/utils/request'
import { request } from '@/utils/request'
import type { User } from './types/user'
// const test = () => {
//   request.get<{}>('patient/order/address')
// }

const login = async () => {
  // const res = await request.post('login/password', {
  //   mobile: '13211112222',
  //   password: 'abc12345'
  // })
  // console.log(res)
  // console.log('后期跳转不是直接去user页面, 先判断地址有没有要返回的地址 ')
  // console.log('存储个人信息并跳转到user页面')
  const res = await request<User>('login/password', 'post', {
    mobile: '13211112222',
    password: 'abc12345'
  })
  console.log(res.data.mobile)
}
</script>
<template>
  <!-- 一级路由出口 -->
  <router-view></router-view>
  <button
    @click="
      user.setUserInfo({
        token: '1',
        refreshToken: '1',
        avatar: '1',
        mobile: '1',
        account: '1',
        id: '1'
      })
    "
  >
    模拟本地登录
  </button>
  <button @click="user.delUserInfo">模拟退出</button>
  <!-- <button @click="test">测试发送请求携带token</button> -->
  <button @click="login">测试发送登录请求</button>
</template>

<style scoped>
.box {
  --mycolor: orange;
  width: 100px;
  height: 100px;
  border: 1px solid #000;
  background-color: var(--wcg);
}
.sidebar {
  color: var(--wcg);
  background-color: var(--mycolor);
}
</style>
